<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>添加员工 - 员工信息管理系统</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css">
</head>
<body>
<div class="container">
    <header class="header">
        <h1>员工信息管理系统</h1>
        <div class="user-info">
            欢迎, ${user.username} |
            <a href="${pageContext.request.contextPath}/logout">退出</a>
        </div>
    </header>

    <nav class="sidebar">
        <ul>
            <li><a href="${pageContext.request.contextPath}/dashboard">仪表板</a></li>
            <li><a href="${pageContext.request.contextPath}/employee">员工管理</a></li>
        </ul>
    </nav>

    <main class="main-content">
        <div class="page-header">
            <h2>添加员工</h2>
            <a href="${pageContext.request.contextPath}/employee" class="btn btn-secondary">返回列表</a>
        </div>

        <c:if test="${not empty error}">
            <div class="alert alert-error">
                    ${error}
            </div>
        </c:if>

        <div class="form-container">
            <form action="${pageContext.request.contextPath}/employee?action=add" method="post">
                <div class="form-row">
                    <div class="form-group">
                        <label for="name">姓名 *</label>
                        <input type="text" id="name" name="name" required>
                    </div>
                    <div class="form-group">
                        <label for="department">部门 *</label>
                        <select id="department" name="department" required>
                            <option value="">请选择部门</option>
                            <option value="技术部">技术部</option>
                            <option value="市场部">市场部</option>
                            <option value="人事部">人事部</option>
                            <option value="财务部">财务部</option>
                            <option value="行政部">行政部</option>
                        </select>
                    </div>
                </div>

                <div class="form-row">
                    <div class="form-group">
                        <label for="position">职位 *</label>
                        <input type="text" id="position" name="position" required>
                    </div>
                    <div class="form-group">
                        <label for="salary">薪资 *</label>
                        <input type="number" id="salary" name="salary" step="0.01" min="0" required>
                    </div>
                </div>

                <div class="form-row">
                    <div class="form-group">
                        <label for="email">邮箱</label>
                        <input type="email" id="email" name="email">
                    </div>
                    <div class="form-group">
                        <label for="phone">电话</label>
                        <input type="tel" id="phone" name="phone">
                    </div>
                </div>

                <div class="form-group">
                    <label for="hireDate">入职日期 *</label>
                    <input type="date" id="hireDate" name="hireDate" required>
                </div>

                <div class="form-actions">
                    <button type="submit" class="btn btn-primary">添加员工</button>
                    <a href="${pageContext.request.contextPath}/employee" class="btn btn-secondary">取消</a>
                </div>
            </form>
        </div>
    </main>
</div>
</body>
</html>